<div class="mt20 clearfix ng-scope ml25">
    <span class="fl lh30 f14">发票信息</span>

    <div class="fr btn-group" style="width: 250px;" ng-if="contractBaseInfo.busnisseType != null || (contractBaseInfo.contract_status != 0 && contractBaseInfo.is_cancelled == 0)">
        <button href="javascript:;" class="btn" id="addVoiceButton"
                ui-dialog="新增发票"
                ui-dialog-data="{}"
                ui-dialog-show="receivableInvoiceService.onInvoiceEditShow(contractBaseInfo.contract_id,$dialog,$dialogScope, 1)"
                ui-dialog-ok="receivableInvoiceService.editInvoiceSave($data,$dialog,$dialogScope,reloadInvoices)"
                ui-dialog-on-close="receivableInvoiceService.onCloseInvoice($dialogScope,1)"
                ui-dialog-cache="false"
                ui-dialog-url="/contract/editinc/receivable-inc-edit-invoice.html"
                >新增发票
        </button>
        <div ng-if="contractBaseInfo.busnisseType == 7">
	        <div id="importInvoiceList" class="fileinput-button btn btn-yellow" ng-click="importInvoiceList()">
		        <span class="f13">导入发票</span>
		        <input type="hidden" name="MAX_FILE_SIZE" value="4194304" />
		        <input type="file" name="file" accept=".xls*">
	        </div>
	        
	        
	        <a class="btn" type="button" href="/api/index.php?r=/contract/export-invoice-model" >导出模板</a>
        </div>

	    <div ng-if="contractBaseInfo.busnisseType != 7" style="width: 300px";>
		    <button href="javascript:;" class="btn"
		            ui-dialog="新增子发票"
		            ui-dialog-data="{}"
		            ui-dialog-show="receivableInvoiceService.onInvoiceEditShow(contractBaseInfo.contract_id,$dialog,$dialogScope, 2)"
		            ui-dialog-ok="receivableInvoiceService.editInvoiceSave($data,$dialog,$dialogScope,reloadInvoices)"
		            ui-dialog-cache="false"
		            ui-dialog-url="/contract/editinc/receivable-inc-edit-invoice.html"
		    >新增子发票
		    </button>
		    <button href="javascript:;" class="btn"
		            ui-dialog="新增收据"
		            ui-dialog-data="{}"
		            ui-dialog-show="receivableInvoiceService.onInvoiceEditShow(contractBaseInfo.contract_id,$dialog,$dialogScope, 4)"
		            ui-dialog-ok="receivableInvoiceService.editInvoiceSave($data,$dialog,$dialogScope,reloadInvoices)"
		            ui-dialog-cache="false"
		            ui-dialog-url="/contract/editinc/receivable-inc-edit-invoice.html"
		    >新增收据
		    </button>
	    </div>
    </div>
</div>
<div id="grid" class="table-wrap mt10 ml25" style="min-height: 200px;">
    <table width="100%" class="valign-t">
        <thead>
        <tr>
            <th width="35">序号</th>
            <th width="150">发票信息</th>
            <th width="70">开票金额</th>
            <th>开票单位</th>
            <th width="160">客户名称</th>
            <th width="70">对应回款</th>
            <th width="70">已回款金额</th>
            <th width="100">附加信息</th>
            <!--<th width="80">对应应收</th>-->
            <th width="80">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="record in receivableInfo.invoices" ng-if="record.__isdelete != 1">
            <td height="40"><p ng-bind="$index + 1"></p></td>
            <td class="lh14">
                <p>{{record.is_receipt==1?'收据':'发票'}}代码:{{record.invoice_code}}</p>

                <p class="c-gray">{{record.is_receipt==1?'收据':'发票'}}号码:{{record.invoice_no}}</p>
            </td>
            <td>
                <p ng-bind="record.invoice_amount | number:2"></p>
            </td>
            <td>
                <p>{{record.BUName}}</p>

                <p class="c-gray">开票时间:{{record.invoice_date | strdate:'yyyy-MM-dd'}}</p>
            </td>
            <td>
                <p ng-bind="record.customer_name"></p>
            </td>
            <td>
                <!--<p ng-bind="record.receivables_amount|number:2"></p>-->
	            <p ng-bind="record.invoice_amount|number:2"></p>
            </td>
            <td>
                <!--<p ng-bind="record.payment_amount|number:2"></p>-->
	            <p ng-bind="record.invoice_amount|number:2"></p>
            </td>
            <td>
                <p>是否遗失:{{record.is_lose==1?'是':'否'}}</p>

                <p>是否红冲:{{record.is_red_invoice==1?'是':'否'}}</p>

                <p>是否收据:{{record.is_receipt==1?'是':'否'}}</p>
            </td>
            <!--<td>-->
                <!--<p ng-bind="record.invoice_receivable"></p>-->
            <!--</td>-->
            <td>
                <div>
                    <a type='edit' href="javascript:;"
                       ui-dialog="编辑发票"
                       ui-dialog-data="{}"
                       ui-dialog-show="receivableInvoiceService.onInvoiceEditShow(contractBaseInfo.contract_id,$dialog,$dialogScope, 1,record)"
                       ui-dialog-ok="receivableInvoiceService.editInvoiceSave($data,$dialog,$dialogScope,reloadInvoices)"
                       ui-dialog-cache="false"
                       ui-dialog-url="/contract/editinc/receivable-inc-edit-invoice.html">
                        编辑
                    </a>
                    <a href="javascript:void(0)" class="clearfix"
                       title="删除{{record.is_receipt==1?'收据':'发票'}}"
                       ng-if="record.is_red_invoice == 0 && !record.red_by_invoice_id"
                       ng-click="receivableInvoiceService.deleteInvoice(record,reloadInvoices)">删除</a>
                    <a href="javascript:void(0)" class="clearfix"
                       title="解绑回款"
                       ui-dialog="解除发票与回款的绑定"
                       ui-dialog-data="{}"
                       ui-dialog-before-show="receivableInvoiceService.beforeUnbindPaymentForInvoice($dialog, $dialogScope, record)"
                       ui-dialog-ok="receivableInvoiceService.unbindPaymentForInvoice($data, reloadInvoices)"
                       ui-dialog-cache="false"
                       ui-dialog-url="/contract/editinc/receivable-inc-edit-unbind-payment.html"
                       ng-hide="record.payment_amount == '0.00'"
                            >解绑回款</a>
                    <a href="javascript:void(0)" class="clearfix"
                       title="红冲发票"
                       ui-dialog="新增红冲发票"
                       ui-dialog-data="{}"
                       ui-dialog-show="receivableInvoiceService.onInvoiceEditShow(contractBaseInfo.contract_id,$dialog,$dialogScope, 3,record)"
                       ui-dialog-ok="receivableInvoiceService.editInvoiceSave($data,$dialog,$dialogScope,reloadInvoices)"
                       ui-dialog-cache="false"
                       ui-dialog-url="/contract/editinc/receivable-inc-edit-invoice.html"
                       ng-if="record.is_receipt == 0 && record.is_red_invoice == 0 && !record.red_by_invoice_id"
                    >红冲此发票</a>
                    <a href="javascript:void(0)" class="clearfix"
                       title="转为发票"
                       ng-if="record.is_receipt == 1"
                       ng-click="receivableInvoiceService.convertToInvoice(record,$event)">转为发票</a>
                </div>

            </td>
        </tr>
        </tbody>
    </table>
    <div class="no-data" ng-if="invoices.length == 0" style="height:180px"><span>暂无数据</span></div>

</div>
